home *** CD-ROM | disk | FTP | other *** search
- Name: LOG2.ASM
- Type: Assembler Macro
- Version: 1.0
- Last Change: 26-Jan-87
-
- This macro will take the log2 of a number by polynomial approximation.
-
- LOG2(x)= 4.0* (-.3372223 x*x + .9981958 x - .6626105)
-
- This polynomial will give approximately 8 significant bits of accuracy.
- This is valid for .5<= x <= 1.
-
- The input value is put into x0, the output value is in register A.
- Register R1 initially points to the coefficients in y memory in
- the order:a1,a2,a0.
-
- R1
- |
- v
- y:.9981958,-.3372223,-.6626105
- a1 a2 a0
-
- Benchmarks for this macro is 7 cycles, 7 instructions.
- The library program LOG2T demonstrates how to use the LOG2 macro.
-